Home

Operator Usage

Name

display-grid

Description

display-grid[width, height]
display-grid[width, height, operator]
display-grid[width, height, operator, empty-char]
display-grid[width, height, operator, empty-char, cell-prefix]
display a rectangular map of the given width and height
where each cell is the value of "operator" applied to that cell (default operator is "value")
where empty-char is printed for cells with value 0 (default value of empty-char is ".")
where cell-prefix is the prefix string for the cells (default value is "grid: ")


Examples

-- learn a small grid first:
learn-grid[9,5]

-- learn some cell values:
value |grid: 2: 2> => |H>
value |grid: 2: 3> => |e>
value |grid: 2: 4> => |l>
value |grid: 2: 5> => |l>
value |grid: 2: 6> => |o>

-- display the resulting grid:
display-grid[9, 5, value, "*"]
    width:  9
    height: 5

    0      *   *   *   *   *   *   *   *   *
    1      *   *   *   *   *   *   *   *   *
    2      *   *   H   e   l   l   o   *   *
    3      *   *   *   *   *   *   *   *   *
    4      *   *   *   *   *   *   *   *   *


See also

Operator type

superposition compound context